package com.vodone.v1pin.component.productlist
{
	import com.vodone.v1pin.component.productlist.renderer.ProductItemRenderer;
	
	import flash.utils.getTimer;
	
	public class ItemCache
	{
		private var arr:Array = [];	
		
		public function ItemCache()
		{
			var start:Number = getTimer();
			for( var i:int = 0 ; i < 48 ; i++ )
			{
				arr.push( new ProductItemRenderer() );
			}
			var end:Number = getTimer();
			trace("缓存初始化：" + ( end - start ) + " ms");
		}
		
		
		public function addItem( item:ProductItemRenderer ):void
		{
			arr.push( item );
		}
		public function getItem():ProductItemRenderer
		{
			if( arr.length > 0 )
			{
				return arr.pop() as ProductItemRenderer;
			}
			return new ProductItemRenderer();
		}
	}
}